* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f9fafb;
    color: #1f2937;
    height: 100vh;
}

/* 全局数学公式样式 */
.mjx-chtml {
    white-space: normal !important;
    font-size: 100% !important;
}
.mjx-chtml span .mjx-char {
    font-family: KaTeX_Math, "Times New Roman" !important;
    font-style: italic;
}
.mjx-chtml .mjx-char.MJXc-TeX-main-R {
    font-style: initial;
}

/* 主容器 */
.chat-container {
    display: flex;
    height: 100vh;
    background: linear-gradient(135deg, #fafafa 0%, #f3f4f6 100%);
}

/* 左侧边栏 */
.sidebar {
    width: 240px;
    background: #ffffff;
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e5e7eb;
    box-shadow: 2px 0 10px rgba(0,0,0,0.04);
}

/* Logo */
.logo {
    margin-bottom: 20px;
    text-align: center;
}
.logo-img {
    border-radius: 12px;
    width: 140px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.06);
}

/* 菜单 */
.menu-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: 10px;
    cursor: pointer;
    color: #374151;
    transition: all 0.25s ease;
}
.menu-item:hover {
    background: #f3f4f6;
    transform: translateX(3px);
}
.menu-item#newChatBtn {
    border: 1px solid rgba(0,0,0,0.12);
    background: #ffffff;
    padding: 8px 10px;
    border-radius: 14px;
    justify-content: space-between;
    margin-bottom: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}
.menu-item#newChatBtn:hover {
    background: #f9fafb;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* 右侧主界面 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-header {
    padding: 18px;
    text-align: center;
    border-bottom: 1px solid #e5e7eb;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.chat-header h1 {
    font-size: 22px;
    font-weight: 600;
    color: #111827;
}

/* 聊天消息区 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9fafb;
    scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar {
    width: 6px;
}
.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.25);
    border-radius: 4px;
}
.chat-messages .bottom-line {
    width: 100%;
    height: 1px;
    background: transparent;
}

/* 输入区 */
.chat-input-container {
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    background: #ffffff;
}
.input-wrapper {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 12px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.06);
    transition: all 0.3s ease;
}
.input-wrapper:has(:focus-within) {
    border-color: #9ca3af;
    box-shadow: 0 6px 18px rgba(0,0,0,0.1);
}
#userInput {
    width: 100%;
    min-height: 28px;
    max-height: 200px;
    border: none;
    outline: none;
    resize: none;
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 8px;
}

/* 按钮区域 */
.input-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.model-select {
    padding: 6px 12px;
    border-radius: 16px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    color: #4b5563;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}
.model-select:hover {
    background: #f3f4f6;
}
.action-buttons {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: #111827;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
}
.action-buttons:hover {
    background: #2563eb;
}
.send-btn .icon {
    width: 22px;
    height: 22px;
    color: #ffffff;
}

/* 历史记录 */
.history-list {
    max-height: calc(100vh - 280px);
    overflow-y: auto;
    margin-top: 12px;
